package cn.com.dycc.sys_manage.usersysmanagement.service;

import java.io.IOException;
import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.apache.http.protocol.HTTP;
import org.springframework.web.multipart.MultipartFile;

import com.baidu.yun.push.exception.PushClientException;
import com.baidu.yun.push.exception.PushServerException;

import cn.com.dycc.sys_manage.rolesysmanagement.service.RoleNotFoundException;
import cn.com.dycc.sys_manage.usersysmanagement.entity.Conver;
import cn.com.dycc.sys_manage.usersysmanagement.entity.UserIndexResult;
import cn.com.dycc.sys_manage.usersysmanagement.entity.UserInfo;
import cn.com.dycc.sys_manage.usersysmanagement.entity.UserInfoAccount;
import cn.com.dycc.sys_manage.usersysmanagement.entity.UserPart;
import cn.com.dycc.sys_manage.usersysmanagement.entity.UserResult;
import cn.com.dycc.sys_manage.usersysmanagement.param.AddUserParam;
import cn.com.dycc.sys_manage.usersysmanagement.param.UserParam;



/**
 * 用户信息业务层接口
 * Description: 
 * Author: linfangan
 * Version: 1.0
 * Create Date Time: 2017年8月14日 上午8:49:21.
 * Update Date Time: 
 * @see
 */
public interface UserService {
	
	/**
	 * 增加用户信息
	 * @param user 用户基本信息
	 * @param roleUser 用户角色授权 集合
	 * @param 
	 * @return 插入成功返回true
	 * @throws UserNotFoundException
	 */
	public String insertUser(AddUserParam user)throws UserNotFoundException,PasswordNotFoundException,
		CeritficateNotFoundException,UserChildAccountNoutFoundException,RoleNotFoundException;
	
	
	/**
	 * 根据用户id查找用户信息
	 * @param id 主账号id
	 * @return
	 */
	public UserResult findAllUserMessageByUserId(HttpServletRequest request,String id)throws UserNotFoundException,RoleNotFoundException;
//	
//	/**
//	 * 分页查询用户T_user的所有信息
//	 * @param size 每页长度
//	 * @param page 每页开始页码
//	 * @return
//	 * @throws UserNotFoundException
//	 */
//	public List<Map<String,Object>> findAllUserInfo(int size,int page,List<Integer> bindRoleNo)throws UserNotFoundException,RoleNotFoundException;
//	
//	
	/**
	 * 根据id删除用户的相关信息
	 * @param userId
	 * @param bindRoleNo
	 * @return
	 * @throws UserNotFoundException
	 */
	public String deleteUserInfoByUserId(HttpServletRequest request,String userId)throws UserNotFoundException,RoleNotFoundException;
//	
//	
	/**
	 * 更新用户信息，先删除，在增加
	 * @param user
	 * @param roleUser
	 * @param userChild
	 * @param userId
	 * @return
	 * @throws UserNotFoundException
	 * @throws PasswordNotFoundException
	 * @throws CeritficateNotFoundException
	 * @throws UserTelNotFoundException
	 * @throws UserChildAccountNoutFoundException
	 */
	public String updateUserInfoByUserId(AddUserParam user)
			throws UserNotFoundException,PasswordNotFoundException,CeritficateNotFoundException,UserChildAccountNoutFoundException,RoleNotFoundException;
	
//	
//	/**
//	 * 查询所有用户所有信息(四表)
//	 * @param bindRoleNo
//	 * @return
//	 * @throws UserNotFoundException
//	 * @throws RoleNotFoundException
//	 */
//	public List<User> selAllUserInfo(List<Integer> bindRoleNo,Integer bindTop_dept_no)throws UserNotFoundException,RoleNotFoundException;
//	
	/**
	 * 批量删除用户账户信息，多表
	 * @param ids
	 * @return
	 * @throws UserNotFoundException
	 * @throws RoleNotFoundException
	 */
	public String delBatchUser(HttpServletRequest request,String ...ids)throws UserNotFoundException,RoleNotFoundException;
	
//	
//	
	//测试
	boolean login(String account,String password,HttpServletRequest req)throws UserNotFoundException,PasswordNotFoundException;
	
	//退出 ketao
	boolean exit(HttpServletRequest req)throws UserNotFoundException;
	
	//退出1 lisuoding
	boolean exit1(HttpServletRequest req)throws UserNotFoundException;
	
	//精确查询用户信息
	public List<UserResult> findUserByArray(HttpServletRequest request,UserParam userParam,String org_id,String state)throws UserNotFoundException;
	
	/**
	 * 查询角色101和102内的人员信息,部门请假显示部门领导,领导请假显示上级部门领导
	 * @return
	 * @throws UserNotFoundException
	 */
	public List<UserInfo> findUserInfoByRoleUser(String dept_no,String user_id)throws UserNotFoundException;
	
	/**
	 * 删除用户实际上是更新用户state状态
	 * @return
	 * @throws UserNotFoundException
	 */
	public String updateState(HttpServletRequest request,String id)throws UserNotFoundException,IOException;
	
	
	/**
	 * 批量删除用户实际上是批量更新用户state状态
	 * @return
	 * @throws UserNotFoundException
	 */
	public String arrupdateState(HttpServletRequest request,String ...ids)throws UserNotFoundException, PushServerException, PushClientException, IOException;
	
	/**
	 * 启用用户实际上是更新用户state状态
	 * @return
	 * @throws UserNotFoundException
	 */
	public String enabledState(HttpServletRequest request,String id)throws UserNotFoundException;
	
	
	/**
	 * 根据部门查询该部门下人员
	 * @param dept_no 部门id或者是上级部门id
	 * @return
	 * @throws UserNotFoundException
	 */
	public List<UserInfoAccount> throwDeptFindUser(HttpServletRequest requset,String dept_no)throws UserNotFoundException;
	
	/**
	 * 查询101和102里面的全部领导
	 * @return
	 * @throws UserNotFoundException
	 */
	public List<UserInfo> findAlleader(String org_id)throws UserNotFoundException;
	
	/**
	 * 查询除了权限为0的全部用户信息
	 * @return
	 * @throws UserNotFoundException
	 */
	public List<UserInfoAccount> CxUserXinXi(String org_id)throws UserNotFoundException;
	
	/**
	 * 查询除了权限为0的全部用户信息，包首字母
	 * @return
	 * @throws UserNotFoundException
	 */
	public List<Conver> conver(String org_id)throws UserNotFoundException;
	
	/**
	 * 根据人物id查询人物信息
	 * @param org_id
	 * @return
	 * @throws UserNotFoundException
	 */
	public UserPart reasonIdfindUser(String id,String org_id)throws UserNotFoundException;
	
	/**
	 * 查询所有用户信息
	 * @param org_id
	 * @return
	 * @throws UserNotFoundException
	 */
	public List<UserResult> allUserinfo(String org_id,String state)throws UserNotFoundException;
	
	//更新密码 lisuoding
	public String updatepassword (HttpServletRequest request,String password,String oldpassword,String id) throws UserNotFoundException,IOException;

	//自动登录 liketao
	boolean autoLogin(String account,String password,HttpServletRequest req)throws UserNotFoundException,PasswordNotFoundException;
	
	/**
	 * 根据id查询用户信息  用于主页个人信息展示
	 * @param id
	 * @return
	 * @throws UserNotFoundException
	 */
	public UserIndexResult indexUserInfo(String id)throws UserNotFoundException;
	
	/**
	 * 更新用户头像
	 * @param userFace
	 * @return
	 * @throws UserNotFoundException
	 */
	public String updateFace(String id,MultipartFile file)throws UserNotFoundException,IllegalStateException, IOException;
	
	/**
	 * 点击增加权限，查询用户列表，给用户增加权限
	 * @return
	 * @throws UserNotFoundException
	 */
	public List<Object> UserLine(String org_id,String role_no,Integer page,Integer limit,String username)throws UserNotFoundException;

	/**
	 * 根据用户id重置用户密码
	 * @param user_id
	 * @return
	 * @throws UserNotFoundException
	 */
	public String restPassword(HttpServletRequest request,String user_id)throws UserNotFoundException;
	
	/**
	 * 用户列表统计查询
	 * @return
	 * @throws UserNotFoundException
	 */
	public String findUserArrayCount(UserParam userParam,String org_id,String state)throws UserNotFoundException;
	
	/**
	 * 统计用户列表人数
	 * @param request
	 * @return
	 * @throws UserNotFoundException
	 */
	public String findUserLineCount(HttpServletRequest request,String username)throws UserNotFoundException;
	
	/**
	 * 用于user查询多条件动态查询多表 将已经是党员的用户排除在外
	 * @param userParam
	 * @param org_id
	 * @param state
	 * @return
	 * @throws UserNotFoundException
	 */
	public List<UserResult> findUserByArrayNotInPartyUser(HttpServletRequest request,UserParam userParam,String state)throws UserNotFoundException;
	
	/**
	 * 用于user查询多条件动态查询多表 将已经是党员的用户排除在外 统计
	 * @return
	 * @throws UserNotFoundException
	 */
	public String findUserByArrayNotInPartyUserCount(HttpServletRequest request,UserParam userParam,String state)throws UserNotFoundException;
}



